<%--
  Created by IntelliJ IDEA.
  User: xiaoji
  Date: 2014/11/24
  Time: 14:13
  To change this template use File | Settings | File Templates.
--%>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c" %>
<c:set value="${pageContext.request.contextPath}" var="path" scope="session"/>
<!DOCTYPE html>

<html>
<head>
    <title>用户财务报表</title>
    <meta charset="UTF-8">
    <link rel="stylesheet" type="text/css" href="${path}/plugins/jquery-easyui-1.4.1/themes/default/easyui.css">
    <link rel="stylesheet" type="text/css" href="${path}/plugins/jquery-easyui-1.4.1/themes/icon.css">
    <script type="text/javascript" src="${path}/plugins/jquery-easyui-1.4.1/jquery.min.js"></script>
    <script type="text/javascript" src="${path}/plugins/jquery-easyui-1.4.1/jquery.easyui.min.js"></script>
    <script type="text/javascript" src="${path}/plugins/jquery-easyui-1.4.1/locale/easyui-lang-zh_CN.js"></script>
    <script language="javascript" type="text/javascript" src="${path}/plugins/My97DatePicker/WdatePicker.js"></script>
    <script type="text/javascript">
        $(function(){
            $("#search_yh").click(function(){


                var currenttab =  $("#search_yh").attr("stab");
                $('#'+currenttab).datagrid('load',{
                    beginTime:$("#userBeginTime").val(),
                    endTime:$("#userEndTime").val(),
                    userName:$("#userName").val(),
                    costType:$("#userCostType").combobox("getValue"),
                    walletStatus:$("#walletStatus").combobox("getValue")
                });

                f_findCountUserFinance();

            });
            f_findCountUserFinance();
        });
        //用户财务报表--查询统计用户财务汇总数据
        function f_findCountUserFinance(){

            $("#yhczSumPrice").html("0");
            $("#yhtxSumPrice").html("0");
            $.post("${path}/userFinance/findCountUserFinance.do",{
                beginTime:$("#userBeginTime").val(),
                endTime:$("#userEndTime").val(),
                userName:$("#userName").val(),
                costType:$("#userCostType").combobox("getValue"),
                walletStatus:$("#walletStatus").combobox("getValue")
            },function(data){
                if(data.errormsg == undefined){

                    for(var i = 0; i < data.sumPriceList.length;i++){

                        var bean = data.sumPriceList[i];

                        //充值
                        if(112101 == bean.type){

                            $("#yhczSumPrice").html(bean.sumMoney);

                        }
                        if(112106 == bean.type){//提现
                            $("#yhtxSumPrice").html(bean.sumMoney);
                        }


                    }



                }else{
                    alert(data.errormsg);
                }
            },"json");

        }


    </script>
</head>
<body class="easyui-layout">
<div region="center" style="padding:5px;" border="false">
    <%--<div id="tabs" class="easyui-tabs" style="width:100%;height: 650px;">--%>
        <%----%>
        <%--<div title="用户财务报表" style="padding:10px">--%>
            <table id="ttyhcwbb" class="easyui-datagrid"
                   data-options="singleSelect:true,collapsible:true,url:'${path}/userFinance/findUserFinanceReport.do',rownumbers: true,
       method:'post',toolbar:'#yhcwbb',pagination:'true',fit:'true'">
                <thead>
                <tr>
                    <th data-options="field:'time',align:'center',width:180">完成时间</th>
                    <th data-options="field:'user_name',align:'center',width:180">用户账号</th>
                    <th data-options="field:'money',align:'center',width:180">金额</th>
                    <th data-options="field:'type',align:'center',width:180">类别</th>
                    <th data-options="field:'wallet_status',align:'center',width:80,formatter: rowformatter" >状态</th>
                    <th data-options="field:'remark',align:'center',width:280">备注</th>


                </tr>
                </thead>
            </table>
        <%--</div>--%>

    <%--</div>--%>
</div>


<!--用户财务报表 头工具项-->
<div id="yhcwbb" style="padding:2px 5px;">
    用户账号: <input class="easyui-textbox" name="userName" id="userName" style="width:110px">
    开始时间: <input placeholder="请选择开始时间"  type="text" id="userBeginTime" onfocus="WdatePicker({dateFmt:'yyyy-MM-dd HH:mm:ss'})" class="Wdate" />
    结束时间: <input placeholder="请选择结束时间"  type="text" id="userEndTime" onfocus="WdatePicker({dateFmt:'yyyy-MM-dd HH:mm:ss'})" class="Wdate" />
    类别:
            <select class="easyui-combobox" data-options="editable:false" id="userCostType" style="width:110px">
                <option value="">所有</option>
                <option value="112101">充值</option>
                <option value="112102">推广收入</option>
                <option value="112103">任务收入</option>
                <option value="112104">活动竞赛收入</option>
                <option value="112105">作品收入</option>
                <option value="112106">提现</option>
                <option value="112107">项目支出</option>
                <option value="112109">购买作品</option>
                <option value="112110">冻结余额</option>
                <option value="112111">竞赛活动支出</option>
                <option value="112112">增值服务支出</option>
                <option value="112108">其他</option>

            </select>
    状态:
            <select class="easyui-combobox" data-options="editable:false" id="walletStatus" style="width:110px">
                <option value="">所有</option>
                <option value="131101">成功</option>
                <option value="131102">失败</option>

            </select>
    <a href="javascript:void(0)" class="easyui-linkbutton" iconCls="icon-search" id="search_yh" stab="ttyhcwbb">查找</a>
    <br/>
    <h3 style="color: #0000ff;">充值合计：<span id="yhczSumPrice" style="color: red;">统计中...</span>
        &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
        提现合计：<span id="yhtxSumPrice" style="color: red;">统计中...</span>
    </h3>
</div>
<script>

    //平台财务报表---类别
    function rowformatter(value,row,index){

       if(value == 131101) {
           return "成功";
       }else if(value == 131102) {
           return "失败";
       }else {
           return value;
       }

    }

</script>
</body>
</html>
